<template>
  <div class="report-page">
    <!-- 页面头部 -->
    <div class="page-header">
      <h1 class="page-title">📊 学习数据报告</h1>
      <p class="page-subtitle">基于科学学习理论的数据分析与学习建议</p>
    </div>

    <!-- 核心指标概览 -->
    <div class="metrics-section">
      <div class="section-header">
        <h2>📈 核心学习指标</h2>
        <p>关键学习数据的可视化展示</p>
      </div>
      <div class="metrics-grid">
        <div class="metric-card" v-for="(metric, index) in coreMetrics" :key="index">
          <div class="metric-icon">{{ metric.icon }}</div>
          <div class="metric-content">
            <div class="metric-value">{{ metric.value }}</div>
            <div class="metric-label">{{ metric.label }}</div>
            <div class="metric-trend" :class="metric.trend">
              <span class="trend-icon">{{ metric.trendIcon }}</span>
              <span class="trend-text">{{ metric.trendText }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 学习进度分析 -->
    <div class="progress-analysis">
      <div class="section-header">
        <h2>🎯 学习进度分析</h2>
        <p>当前学习阶段与掌握程度评估</p>
      </div>
      <div class="progress-content">
        <div class="progress-overview">
          <div class="progress-info">
            <h3>{{ currentStage }}</h3>
            <p>当前学习阶段</p>
            <div class="progress-stats">
              <div class="stat-item">
                <span class="stat-number">{{ pathProgress }}%</span>
                <span class="stat-label">完成进度</span>
              </div>
              <div class="stat-item">
                <span class="stat-number">{{ masteryLevel }}%</span>
                <span class="stat-label">掌握程度</span>
              </div>
            </div>
          </div>
          <div class="progress-visual">
            <div class="circular-progress">
              <svg class="progress-ring" width="120" height="120">
                <circle
                  class="progress-ring-circle"
                  stroke="#e2e8f0"
                  stroke-width="8"
                  fill="transparent"
                  r="52"
                  cx="60"
                  cy="60"
                />
                <circle
                  class="progress-ring-fill"
                  stroke="#3b82f6"
                  stroke-width="8"
                  fill="transparent"
                  r="52"
                  cx="60"
                  cy="60"
                  :stroke-dasharray="circumference"
                  :stroke-dashoffset="circumference - (pathProgress / 100) * circumference"
                />
              </svg>
              <div class="progress-text">{{ pathProgress }}%</div>
            </div>
          </div>
        </div>
        <div class="progress-bar-container">
          <div class="progress-bar">
            <div class="progress-fill" :style="{ width: pathProgress + '%' }"></div>
          </div>
        </div>
      </div>
    </div>

    <!-- 学习趋势图表 -->
    <div class="trends-section">
      <div class="section-header">
        <h2>📈 学习趋势分析</h2>
        <p>7天学习数据趋势与模式识别</p>
      </div>
      <div class="trends-content">
        <div class="chart-container">
          <div ref="chartRef" class="chart-wrapper"></div>
        </div>
        <div class="trend-insights">
          <h3>📊 趋势洞察</h3>
          <div class="insights-list">
            <div class="insight-item" v-for="(insight, index) in trendInsights" :key="index">
              <div class="insight-icon">{{ insight.icon }}</div>
              <div class="insight-content">
                <h4>{{ insight.title }}</h4>
                <p>{{ insight.description }}</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 学习建议 -->
    <div class="recommendations-section">
      <div class="section-header">
        <h2>💡 个性化学习建议</h2>
        <p>基于你的学习数据生成的智能建议</p>
      </div>
      <div class="recommendations-grid">
        <div class="recommendation-card" v-for="(rec, index) in recommendations" :key="index">
          <div class="rec-icon">{{ rec.icon }}</div>
          <div class="rec-content">
            <h3>{{ rec.title }}</h3>
            <p>{{ rec.description }}</p>
            <div class="rec-action">
              <el-button size="small" :type="rec.actionType" @click="executeRecommendation(rec.action)">
                {{ rec.actionText }}
              </el-button>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 知识点掌握情况 -->
    <div class="knowledge-section">
      <div class="section-header">
        <h2>🧠 知识点掌握情况</h2>
        <p>各知识点的掌握程度与复习建议</p>
      </div>
      <div class="knowledge-grid">
        <div class="knowledge-card" v-for="(knowledge, index) in knowledgePoints" :key="index">
          <div class="knowledge-header">
            <h3>{{ knowledge.name }}</h3>
            <div class="mastery-level" :class="knowledge.level">
              {{ knowledge.masteryText }}
            </div>
          </div>
          <div class="knowledge-progress">
            <div class="progress-bar">
              <div class="progress-fill" :style="{ width: knowledge.mastery + '%' }"></div>
            </div>
            <span class="progress-text">{{ knowledge.mastery }}%</span>
          </div>
          <div class="knowledge-actions">
            <el-button size="small" v-if="knowledge.mastery < 80" @click="reviewKnowledge(knowledge.id)">
              需要复习
            </el-button>
            <el-button size="small" type="success" v-else>
              已掌握
            </el-button>
          </div>
        </div>
      </div>
    </div>

    <!-- 学习成就 -->
    <div class="achievements-section">
      <div class="section-header">
        <h2>🏆 学习成就</h2>
        <p>解锁的成就与学习里程碑</p>
      </div>
      <div class="achievements-grid">
        <div class="achievement-card" v-for="(achievement, index) in achievements" :key="index">
          <div class="achievement-icon">{{ achievement.icon }}</div>
          <div class="achievement-content">
            <h3>{{ achievement.title }}</h3>
            <p>{{ achievement.description }}</p>
            <div class="achievement-date">{{ achievement.date }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import * as echarts from 'echarts'

export default {
  name: 'LearnReport',
  data() {
    return {
      chart: null,
      studyTime: 320,
      streak: 12,
      masteredKnowledge: ['二进制', '排序算法', '计算机网络基础'],
      currentStage: '计算机基础',
      pathProgress: 65,
      masteryLevel: 78,
      circumference: 2 * Math.PI * 52, // 圆形进度条周长
    }
  },
  computed: {
    summary() {
      return this.$store.getters.summary || []
    },
    score() {
      return this.$store.getters.score || 0
    },
    total() {
      return this.$store.getters.total || 0
    },
    rate() {
      return this.total ? Math.round((this.score / this.total) * 100) : 0
    },
    // 核心指标数据
    coreMetrics() {
      return [
        {
          icon: '⏳',
          value: `${this.studyTime} 分钟`,
          label: '学习总时长',
          trend: 'up',
          trendIcon: '📈',
          trendText: '比上周 +15%'
        },
        {
          icon: '🔥',
          value: `${this.streak} 天`,
          label: '连续学习天数',
          trend: 'up',
          trendIcon: '📈',
          trendText: '保持良好'
        },
        {
          icon: '🎯',
          value: `${this.rate}%`,
          label: '答题正确率',
          trend: 'up',
          trendIcon: '📈',
          trendText: '比上周 +8%'
        },
        {
          icon: '🧠',
          value: `${this.masteryLevel}%`,
          label: '知识掌握度',
          trend: 'up',
          trendIcon: '📈',
          trendText: '稳步提升'
        }
      ]
    },
    // 趋势洞察
    trendInsights() {
      return [
        {
          icon: '📊',
          title: '学习时间分布',
          description: '你的最佳学习时间在上午9-11点，建议保持这个时间段的学习习惯'
        },
        {
          icon: '🎯',
          title: '正确率趋势',
          description: '最近3天正确率呈上升趋势，说明学习效果良好'
        },
        {
          icon: '⏰',
          title: '学习频率',
          description: '建议每天保持30-45分钟的学习时间，避免一次性学习过久'
        }
      ]
    },
    // 学习建议
    recommendations() {
      return [
        {
          icon: '🔄',
          title: '复习薄弱知识点',
          description: '基于你的答题记录，建议重点复习算法基础相关知识点',
          actionType: 'primary',
          actionText: '开始复习',
          action: 'review'
        },
        {
          icon: '📚',
          title: '扩展学习内容',
          description: '当前阶段掌握良好，可以开始学习下一个知识模块',
          actionType: 'success',
          actionText: '继续学习',
          action: 'continue'
        },
        {
          icon: '⏰',
          title: '调整学习节奏',
          description: '建议增加每日学习时间至45分钟，提高学习效率',
          actionType: 'warning',
          actionText: '设置提醒',
          action: 'reminder'
        }
      ]
    },
    // 知识点掌握情况
    knowledgePoints() {
      return [
        {
          id: 1,
          name: '数据结构基础',
          mastery: 85,
          level: 'good',
          masteryText: '良好'
        },
        {
          id: 2,
          name: '算法思维',
          mastery: 72,
          level: 'medium',
          masteryText: '一般'
        },
        {
          id: 3,
          name: '编程基础',
          mastery: 90,
          level: 'excellent',
          masteryText: '优秀'
        },
        {
          id: 4,
          name: '计算机网络',
          mastery: 65,
          level: 'medium',
          masteryText: '一般'
        }
      ]
    },
    // 学习成就
    achievements() {
      return [
        {
          icon: '🎯',
          title: '学习新手',
          description: '完成第一次学习任务',
          date: '2024-01-15'
        },
        {
          icon: '🔥',
          title: '连续学习者',
          description: '连续学习7天',
          date: '2024-01-22'
        },
        {
          icon: '📚',
          title: '知识探索者',
          description: '掌握10个知识点',
          date: '2024-01-25'
        },
        {
          icon: '🏆',
          title: '高效学习者',
          description: '单次学习时长超过60分钟',
          date: '2024-01-28'
        }
      ]
    }
  },
  mounted() {
    this.initChart()
    window.addEventListener('resize', this.handleResize)
  },
  beforeDestroy() {
    if (this.chart) {
      this.chart.dispose()
      this.chart = null
    }
    window.removeEventListener('resize', this.handleResize)
  },
  methods: {
    initChart() {
      if (!this.$refs.chartRef) return
      
      this.chart = echarts.init(this.$refs.chartRef)
      
      const option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            crossStyle: {
              color: '#999'
            }
          },
          backgroundColor: 'rgba(255, 255, 255, 0.95)',
          borderColor: '#e1e5e9',
          borderWidth: 1,
          textStyle: {
            color: '#2c3e50'
          }
        },
        legend: {
          data: ['学习时长(分钟)', '正确率(%)', '掌握度(%)'],
          textStyle: {
            color: '#2c3e50',
            fontSize: 12
          },
          top: 10
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          top: '15%',
          containLabel: true
        },
        xAxis: {
          type: 'category',
          data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
          axisLabel: {
            color: '#64748b',
            fontSize: 12
          },
          axisLine: {
            lineStyle: {
              color: '#e2e8f0'
            }
          }
        },
        yAxis: [
          {
            type: 'value',
            name: '时长(分钟)',
            axisLabel: {
              color: '#64748b',
              fontSize: 12
            },
            axisLine: {
              lineStyle: {
                color: '#e2e8f0'
              }
            },
            splitLine: {
              lineStyle: {
                color: '#f1f5f9'
              }
            }
          },
          {
            type: 'value',
            name: '百分比(%)',
            max: 100,
            axisLabel: {
              color: '#64748b',
              fontSize: 12
            },
            axisLine: {
              lineStyle: {
                color: '#e2e8f0'
              }
            },
            splitLine: {
              show: false
            }
          }
        ],
        series: [
          {
            name: '学习时长(分钟)',
            type: 'bar',
            data: [30, 45, 50, 20, 70, 35, 60],
            itemStyle: {
              color: {
                type: 'linear',
                x: 0, y: 0, x2: 0, y2: 1,
                colorStops: [
                  { offset: 0, color: '#3b82f6' },
                  { offset: 1, color: '#1d4ed8' }
                ]
              },
              borderRadius: [4, 4, 0, 0]
            },
            emphasis: {
              itemStyle: {
                color: {
                  type: 'linear',
                  x: 0, y: 0, x2: 0, y2: 1,
                  colorStops: [
                    { offset: 0, color: '#2563eb' },
                    { offset: 1, color: '#1e40af' }
                  ]
                }
              }
            }
          },
          {
            name: '正确率(%)',
            type: 'line',
            yAxisIndex: 1,
            data: [80, 90, 85, 70, 95, 88, 92],
            itemStyle: {
              color: '#10b981'
            },
            lineStyle: {
              color: '#10b981',
              width: 3
            },
            symbol: 'circle',
            symbolSize: 8,
            emphasis: {
              itemStyle: {
                color: '#059669',
                borderColor: '#fff',
                borderWidth: 2
              }
            }
          },
          {
            name: '掌握度(%)',
            type: 'line',
            yAxisIndex: 1,
            data: [65, 68, 72, 70, 78, 75, 78],
            itemStyle: {
              color: '#f59e0b'
            },
            lineStyle: {
              color: '#f59e0b',
              width: 3
            },
            symbol: 'circle',
            symbolSize: 8,
            emphasis: {
              itemStyle: {
                color: '#d97706',
                borderColor: '#fff',
                borderWidth: 2
              }
            }
          }
        ]
      }
      
      this.chart.setOption(option)
    },
    handleResize() {
      if (this.chart) {
        this.chart.resize()
      }
    },
    // 执行学习建议
    executeRecommendation(action) {
      switch (action) {
        case 'review':
          this.$router.push('/review')
          break
        case 'continue':
          this.$router.push('/learn')
          break
        case 'reminder':
          this.$message.info('学习提醒已设置')
          break
        default:
          this.$message.info('功能开发中')
      }
    },
    // 复习知识点
    reviewKnowledge(knowledgeId) {
      this.$router.push(`/review?knowledge=${knowledgeId}`)
    }
  }
}
</script>

<style scoped>
/* 页面容器 */
.report-page {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
}

.report-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  z-index: -1;
}

/* 页面头部样式 */
.page-header {
  text-align: center;
  margin-bottom: 50px;
  padding: 50px 0;
  border-radius: 20px;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 15px 0;
}

.page-subtitle {
  font-size: 1.2rem;
  color: #64748b;
  margin: 0 0 30px 0;
}

.header-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.header-actions .el-button {
  border-radius: 25px;
  padding: 12px 30px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-icon {
  margin-right: 8px;
  font-size: 1.1rem;
}

/* 区域通用样式 */
.section-header {
  text-align: left;
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 10px 0;
  position: relative;
}

.section-header h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 2px;
}

.section-header p {
  font-size: 1.1rem;
  color: #64748b;
  margin: 0;
}

/* 核心指标概览 */
.metrics-section {
  margin-bottom: 50px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
}

.metric-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  text-align: center;
}

.metric-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

.metric-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.metric-content {
  text-align: center;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 8px;
}

.metric-label {
  font-size: 1rem;
  color: #64748b;
  margin-bottom: 10px;
  font-weight: 500;
}

.metric-trend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 500;
}

.metric-trend.up {
  color: #10b981;
}

.metric-trend.down {
  color: #ef4444;
}

.trend-icon {
  font-size: 0.9rem;
}

/* 学习进度分析 */
.progress-analysis {
  margin-bottom: 50px;
}

.progress-content {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
}

.progress-overview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 30px;
}

.progress-info {
  flex: 1;
  min-width: 300px;
}

.progress-info h3 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 8px;
}

.progress-info p {
  font-size: 1.1rem;
  color: #64748b;
  margin-bottom: 25px;
}

.progress-stats {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 500;
}

.progress-visual {
  flex-shrink: 0;
}

.circular-progress {
  position: relative;
  display: inline-block;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-circle {
  transition: stroke-dashoffset 0.8s ease-in-out;
}

.progress-ring-fill {
  transition: stroke-dashoffset 0.8s ease-in-out;
  stroke-linecap: round;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: 700;
  color: #3b82f6;
}

.progress-bar-container {
  margin-top: 20px;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  transition: width 0.8s ease-in-out;
  border-radius: 6px;
}

/* 学习趋势图表 */
.trends-section {
  margin-bottom: 50px;
}

.trends-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}

.chart-container {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
}

.chart-wrapper {
  width: 100%;
  height: 400px;
}

.trend-insights {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
}

.trend-insights h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 25px;
  text-align: center;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 15px;
  border: 1px solid #e2e8f0;
}

.insight-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.insight-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
}

.insight-content p {
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}

/* 学习建议 */
.recommendations-section {
  margin-bottom: 50px;
}

.recommendations-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
}

.recommendation-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  text-align: center;
}

.recommendation-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

.rec-icon {
  font-size: 3rem;
  margin-bottom: 20px;
}

.rec-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 15px;
}

.rec-content p {
  font-size: 1rem;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 20px;
}

.rec-action {
  margin-top: 20px;
}

/* 知识点掌握情况 */
.knowledge-section {
  margin-bottom: 50px;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
}

.knowledge-card {
  background: white;
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.knowledge-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(59, 130, 246, 0.15);
}

.knowledge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.knowledge-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
}

.mastery-level {
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 0.85rem;
  font-weight: 500;
}

.mastery-level.excellent {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.mastery-level.good {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.mastery-level.medium {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.knowledge-progress {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.knowledge-progress .progress-bar {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.knowledge-progress .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  transition: width 0.8s ease-in-out;
}

.progress-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #3b82f6;
  min-width: 40px;
}

.knowledge-actions {
  text-align: center;
}

/* 学习成就 */
.achievements-section {
  margin-bottom: 50px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
}

.achievement-card {
  background: white;
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  text-align: center;
}

.achievement-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(59, 130, 246, 0.15);
}

.achievement-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.achievement-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
}

.achievement-content p {
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 15px;
}

.achievement-date {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
}

/* 学习总览 */
.overview-section {
  margin-bottom: 40px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.overview-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
  transform: translateY(30px);
  display: flex;
  align-items: center;
  gap: 20px;
}

.overview-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.overview-card:active {
  transform: translateY(-2px);
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.overview-card:nth-child(1) { animation-delay: 0.1s; }
.overview-card:nth-child(2) { animation-delay: 0.2s; }
.overview-card:nth-child(3) { animation-delay: 0.3s; }

.overview-icon {
  font-size: 3rem;
  flex-shrink: 0;
}

.overview-content {
  flex: 1;
}

.overview-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 8px;
}

.overview-label {
  font-size: 1rem;
  color: #7f8c8d;
  font-weight: 500;
}

/* 学习进度 */
.progress-section {
  margin-bottom: 40px;
}

.progress-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
  transform: translateY(30px);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 20px;
}

.progress-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-label {
  font-size: 0.9rem;
  color: #7f8c8d;
  font-weight: 500;
}

.stage-name {
  font-size: 1.3rem;
  color: #2c3e50;
  font-weight: 600;
}

.progress-stats {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.progress-item {
  text-align: center;
}

.progress-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: #3b82f6;
}

.progress-text {
  font-size: 0.9rem;
  color: #7f8c8d;
  font-weight: 500;
}

.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.progress-bar {
  flex: 1;
  height: 12px;
  background: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #1e3a8a 100%);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.progress-percentage {
  font-size: 1rem;
  color: #3b82f6;
  font-weight: 600;
  min-width: 50px;
}

/* 图表区域 */
.chart-section {
  margin-bottom: 40px;
}

.chart-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
  transform: translateY(30px);
}

.chart-wrapper {
  width: 100%;
  height: 400px;
}

/* 统计网格 */
.stats-section {
  margin-bottom: 40px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.stat-card {
  background: white;
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
  transform: translateY(30px);
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.stat-card:active {
  transform: translateY(-2px);
}

.stat-card.highlight {
  border-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 1rem;
  color: #7f8c8d;
  font-weight: 500;
}

/* 问题列表 */
.questions-section {
  margin-bottom: 40px;
}

.questions-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-card {
  background: white;
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
  transform: translateY(30px);
}

.question-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.question-card:active {
  transform: translateY(-1px);
}

.question-card.correct {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.02) 100%);
}

.question-card.incorrect {
  border-color: #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(239, 68, 68, 0.02) 100%);
}

.question-card:nth-child(1) { animation-delay: 0.1s; }
.question-card:nth-child(2) { animation-delay: 0.2s; }
.question-card:nth-child(3) { animation-delay: 0.3s; }
.question-card:nth-child(4) { animation-delay: 0.4s; }
.question-card:nth-child(5) { animation-delay: 0.5s; }

.question-header {
  margin-bottom: 20px;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.question-number {
  font-size: 1.2rem;
  font-weight: 600;
  color: #2c3e50;
}

.question-status {
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-correct {
  color: #10b981;
}

.status-incorrect {
  color: #ef4444;
}

.status-icon {
  font-size: 1.1rem;
}

.question-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-text {
  font-size: 1.1rem;
  color: #2c3e50;
  line-height: 1.6;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border-left: 4px solid #3b82f6;
}

.answer-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.answer-row {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 3px solid #3b82f6;
  transition: all 0.3s ease;
}

.answer-row:hover {
  background: #e9ecef;
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.answer-row.correct-answer {
  border-left-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.answer-label {
  font-weight: 600;
  color: #2c3e50;
  min-width: 90px;
  font-size: 0.95rem;
}

.answer-value {
  color: #2c3e50;
  font-weight: 500;
  font-size: 1rem;
  flex: 1;
}

.answer-value.wrong {
  color: #ef4444;
}

.answer-value.correct {
  color: #10b981;
}

.explanation-section {
  padding: 20px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(30, 58, 138, 0.1) 100%);
  border-radius: 12px;
  border-left: 4px solid #3b82f6;
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.explanation-icon {
  font-size: 1.3rem;
}

.explanation-title {
  font-weight: 600;
  color: #2c3e50;
  font-size: 1rem;
}

.explanation-text {
  color: #2c3e50;
  line-height: 1.7;
  font-size: 0.95rem;
  font-weight: 400;
}

/* 操作按钮 */
.actions-section {
  text-align: center;
  margin-top: 40px;
  padding: 40px 0;
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn {
  padding: 15px 30px;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
  justify-content: center;
}

.primary-btn {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(30, 58, 138, 0.4);
}

.primary-btn:active {
  transform: translateY(0px);
}

.secondary-btn:active {
  transform: translateY(0px);
}

.secondary-btn {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #2c3e50;
  border: 2px solid #e9ecef;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.secondary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.btn-icon {
  font-size: 1.2rem;
}

/* 加载状态 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 成功状态 */
.success {
  color: #27ae60;
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* 错误状态 */
.error {
  color: #e74c3c;
  animation: errorShake 0.6s ease-out;
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .trends-content {
    grid-template-columns: 1fr;
    gap: 25px;
  }
  
  .recommendations-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .knowledge-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .report-page {
    padding: 15px;
  }

  .page-header {
    padding: 30px 20px;
  }

  .page-title {
    font-size: 2rem;
  }

  .page-subtitle {
    font-size: 1rem;
  }

  .header-actions {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .header-actions .el-button {
    width: 100%;
    max-width: 250px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .metric-card {
    padding: 20px;
  }

  .progress-overview {
    flex-direction: column;
    text-align: center;
    gap: 25px;
  }

  .progress-stats {
    justify-content: center;
    gap: 30px;
  }

  .trends-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .chart-container,
  .trend-insights {
    padding: 20px;
  }

  .chart-wrapper {
    height: 300px;
  }

  .recommendations-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .recommendation-card {
    padding: 25px;
  }

  .knowledge-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .knowledge-card {
    padding: 20px;
  }

  .achievements-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .achievement-card {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.8rem;
  }

  .page-subtitle {
    font-size: 0.9rem;
  }

  .section-header h2 {
    font-size: 1.5rem;
  }

  .metric-card,
  .progress-content,
  .chart-container,
  .trend-insights,
  .recommendation-card,
  .knowledge-card,
  .achievement-card {
    padding: 20px;
  }

  .metric-value {
    font-size: 1.5rem;
  }

  .progress-info h3 {
    font-size: 1.5rem;
  }

  .stat-number {
    font-size: 1.8rem;
  }

  .chart-wrapper {
    height: 250px;
  }

  .rec-icon,
  .achievement-icon {
    font-size: 2.5rem;
  }

  .insight-item {
    padding: 15px;
  }

  .insight-content h4 {
    font-size: 1rem;
  }

  .insight-content p {
    font-size: 0.85rem;
  }

  .header-actions .el-button {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
}
</style>